spacing: 5px;
}
-.login-dialog-prompt-login-hint-message {
- font-size: 10.5pt;
-}
-
.login-dialog-user-list-view {
-st-vfade-offset: 1em;
}
background-color: rgba(102, 102, 102, 0.15);
}
+.login-dialog-message-warning,
+.login-dialog-message-info {
+ padding-top: 4px;
+ padding-bottom: 16px;
+ min-height: 2em;
+}
+
.login-dialog-message-warning {
color: orange;
}
+.login-dialog-message-hint {
+ padding-bottom: 16px;
+ min-height: 2em;
+}
+
.user-widget-label {
font-size: 16pt;
font-weight: bold;
DONT_PROVIDE_USERNAME: 1
};
+let _messageStyleMap;
+
const AuthPrompt = new Lang.Class({
Name: 'AuthPrompt',
this._userVerifier.connect('verification-failed', Lang.bind(this, this._onVerificationFailed));
this._userVerifier.connect('verification-complete', Lang.bind(this, this._onVerificationComplete));
this._userVerifier.connect('reset', Lang.bind(this, this._onReset));
- this._userVerifier.connect('show-login-hint', Lang.bind(this, this._onShowLoginHint));
- this._userVerifier.connect('hide-login-hint', Lang.bind(this, this._onHideLoginHint));
this._userVerifier.connect('smartcard-status-changed', Lang.bind(this, this._onSmartcardStatusChanged));
this.smartcardDetected = this._userVerifier.smartcardDetected;
this._message = new St.Label({ opacity: 0 });
this._message.clutter_text.line_wrap = true;
- this.actor.add(this._message, { x_fill: true });
-
- this._loginHint = new St.Label({ style_class: 'login-dialog-prompt-login-hint-message' });
- this.actor.add(this._loginHint);
+ this.actor.add(this._message, { x_fill: true, y_align: St.Align.START });
this._buttonBox = new St.BoxLayout({ style_class: 'login-dialog-button-box',
vertical: false });
this.reset();
},
- _onShowMessage: function(userVerifier, message, styleClass) {
- this.setMessage(message, styleClass);
+ _onShowMessage: function(userVerifier, message, type) {
+ this.setMessage(message, type);
this.emit('prompted');
},
}
},
- _onShowLoginHint: function(verifier, message) {
- this.setHint(message);
- },
-
- _onHideLoginHint: function() {
- this.setHint(null);
- },
-
addActorToDefaultButtonWell: function(actor) {
this._defaultButtonWell.add_child(actor);
this._label.show();
this._entry.show();
- this._loginHint.opacity = 0;
- this._loginHint.show();
-
this._entry.grab_key_focus();
},
});
},
- setMessage: function(message, styleClass) {
+ _initMessageStyleMap: function() {
+ if (_messageStyleMap)
+ return;
+
+ _messageStyleMap = {};
+ _messageStyleMap[GdmUtil.MessageType.NONE] = '';
+ _messageStyleMap[GdmUtil.MessageType.ERROR] = 'login-dialog-message-warning';
+ _messageStyleMap[GdmUtil.MessageType.INFO] = 'login-dialog-message-info';
+ _messageStyleMap[GdmUtil.MessageType.HINT] = 'login-dialog-message-hint';
+
+ },
+
+ setMessage: function(message, type) {
+ this._initMessageStyleMap();
if (message) {
Tweener.removeTweens(this._message);
this._message.text = message;
- this._message.styleClass = styleClass;
+ this._message.styleClass = _messageStyleMap[type];
this._message.opacity = 255;
} else {
+ this._message.styleClass = null;
this._message.opacity = 0;
}
},
hide: function() {
this.setActorInDefaultButtonWell(null, true);
this.actor.hide();
- this._loginHint.opacity = 0;
+ this._message.opacity = 0;
this.setUser(null);
}
},
- setHint: function(message) {
- if (message) {
- this._loginHint.set_text(message)
- this._loginHint.opacity = 255;
- } else {
- this._loginHint.opacity = 0;
- this._loginHint.set_text('');
- }
- },
-
reset: function() {
let oldStatus = this.verificationStatus;
this.verificationStatus = AuthPromptStatus.NOT_VERIFYING;
this._message.opacity = 0;
this.setUser(null);
this.stopSpinning();
- this.setHint(null);
if (oldStatus == AuthPromptStatus.VERIFICATION_FAILED)
this.emit('failed');
// Translators: this message is shown below the username entry field
// to clue the user in on how to login to the local network realm
- this._authPrompt.setHint(_("(e.g., user or %s)").format(hint));
+ this._authPrompt.setMessage(_("(e.g., user or %s)").format(hint), AuthPrompt.MessageType.HINT);
},
_askForUsernameAndBeginVerification: function() {
// Give user 16ms to read each character of a PAM message
const USER_READ_TIME = 16
+const MessageType = {
+ NONE: 0,
+ ERROR: 1,
+ INFO: 2,
+ HINT: 3
+};
+
function fadeInActor(actor) {
if (actor.opacity == 255 && actor.visible)
return null;
return;
let message = this._messageQueue.shift();
- this.emit('show-message', message.text, message.iconName);
+
+ this.emit('show-message', message.text, message.type);
this._messageQueueTimeoutId = GLib.timeout_add(GLib.PRIORITY_DEFAULT,
message.interval,
}));
},
- _queueMessage: function(message, iconName) {
+ _queueMessage: function(message, messageType) {
let interval = this._getIntervalForMessage(message);
this.hasPendingMessages = true;
- this._messageQueue.push({ text: message, interval: interval, iconName: iconName });
+ this._messageQueue.push({ text: message, type: messageType, interval: interval });
this._queueMessageTimeout();
},
GLib.source_remove(this._messageQueueTimeoutId);
this._messageQueueTimeoutId = 0;
}
- this.emit('show-message', null, null);
+ this.emit('show-message', null, MessageType.NONE);
},
_checkForFingerprintReader: function() {
logError(error, where);
this._hold.release();
- this._queueMessage(_("Authentication error"), 'login-dialog-message-warning');
+ this._queueMessage(_("Authentication error"), MessageType.ERROR);
this._verificationFailed(false);
},
_onInfo: function(client, serviceName, info) {
if (this.serviceIsForeground(serviceName)) {
- this._queueMessage(info, 'login-dialog-message-info');
+ this._queueMessage(info, MessageType.INFO);
} else if (serviceName == FINGERPRINT_SERVICE_NAME &&
this._haveFingerprintReader) {
// We don't show fingerprint messages directly since it's
// Translators: this message is shown below the password entry field
// to indicate the user can swipe their finger instead
- this.emit('show-login-hint', _("(or swipe finger)"));
+ this._queueMessage(_("(or swipe finger)"), MessageType.HINT);
}
},
if (!this.serviceIsForeground(serviceName))
return;
- this._queueMessage(problem, 'login-dialog-message-warning');
+ this._queueMessage(problem, MessageType.ERROR);
},
_onInfoQuery: function(client, serviceName, question) {
if (this.serviceIsForeground(serviceName)) {
this._verificationFailed(true);
}
-
- this.emit('hide-login-hint');
},
});
Signals.addSignalMethods(ShellUserVerifier.prototype);